Crate open

source · []
Expand description

Use this library to open a path or URL using the program configured on the system.

Usage

Open the given URL in the default web browser.

open::that("http://rust-lang.org").unwrap();

Alternatively, specify the program to be used to open the path or URL.

open::with("http://rust-lang.org", "firefox").unwrap();

Notes

As an operating system program is used, the open operation can fail. Therefore, you are advised to at least check the result and behave accordingly, e.g. by letting the user know that the open operation failed.

let path = "http://rust-lang.org";

match open::that(path) {
    Ok(()) => println!("Opened '{}' successfully.", path),
    Err(err) => eprintln!("An error occurred when opening '{}': {}", path, err),
}

Functions

Open path with the default application.

Open path with the default application in a new thread.

Open path with the given application.

Open path with the given application in a new thread.